<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>运算</title>
	</head>
	<body>
		
		<input type="button" name="yunsuan" value="计算2数运算结果" onclick="study()" />
		<script type="text/javascript">
			function study(){
			var num1=prompt("输入第一个数","");
			var num2=prompt("输入运算符号","");
			var num3=prompt("输入第二个数","");
			var n1=parseInt(num1);
			
			var n3=parseInt(num3);
		
			if(num2=="+"){
				alert(n1+n3+"="+"n1+n3");
				document.write(n1+n3);
			}
			else if(num2=="-"){
				document.write(n1-n3);
				alert(n1-n3+"="+"n1-n3");
			}
			else if(num2=="*"){
				document.write(n1*n3);
				alert(n1*n3+"="+"n1*n3");
			}
			else if(num2=="/"){
				document.write(n1/n3);
				alert(n1/n3+"="+"n1&n3");
			}
			
			
		}
		</script>
	</body>
</html>
